package com.ftg.midamall.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ftg.midamall.admin.dto.ModifyAdminInfo;
import com.ftg.midamall.admin.dto.UmsMenuVoo;
import com.ftg.midamall.admin.entity.UmsMenu;
import com.ftg.midamall.admin.dto.UmsMenuVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 菜单
 *
 * @author qjw
 * @version 1.0
 * @date 2023/10/24 15:20
 */
@Mapper
public interface UmsMenuMapper extends BaseMapper<UmsMenu> {

    List<UmsMenu> showMenuByAdminId(@Param("id") Long id);

    @Insert("insert into ums_menu(parent_id,title,level,name,icon) values (#{ge.parent_id},#{ge.title},#{ge.level},#{ge.name},#{ge.icon})")
    int addmenu(@Param("ge") UmsMenuVo ge);

    @Delete("delete from ums_menu where id=#{id}")
    int deletemenu(@Param("id") int id);

    @Select("select * from ums_menu where name=#{name}")
    UmsMenu selectmenuByname(@Param("name") String name);

    @Select("select * from ums_menu where id=#{id}")
    UmsMenu selectmenuByid(@Param("id") long id);

    @Update("update ums_menu set parent_id=#{se.parent_id},title=#{se.title},level=#{se.level},name=#{se.name},icon=#{se.icon} where id=#{id}")
    int updatemenu(@Param("se") UmsMenuVo se, @Param("id") int id);

    @Select("select * from ums_menu where name like concat('%',#{part},'%')")
    List<UmsMenu> selectMenulike(@Param("part") String start);




}
